.\"
.\" Copyright (C) 1994-2021 Altair Engineering, Inc.
.\" For more information, contact Altair at www.altair.com.
.\"
.\" This file is part of both the OpenPBS software ("OpenPBS")
.\" and the PBS Professional ("PBS Pro") software.
.\"
.\" Open Source License Information:
.\"
.\" OpenPBS is free software. You can redistribute it and/or modify it under
.\" the terms of the GNU Affero General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" OpenPBS is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
.\" License for more details.
.\"
.\" You should have received a copy of the GNU Affero General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.\"
.\" Commercial License Information:
.\"
.\" PBS Pro is commercially licensed software that shares a common core with
.\" the OpenPBS software.  For a copy of the commercial license terms and
.\" conditions, go to: (http://www.pbspro.com/agreement.html) or contact the
.\" Altair Legal Department.
.\"
.\" Altair's dual-license business model allows companies, individuals, and
.\" organizations to create proprietary derivative works of OpenPBS and
.\" distribute them - whether embedded or bundled with other software -
.\" under a commercial license agreement.
.\"
.\" Use of Altair's trademarks, including but not limited to "PBS™",
.\" "OpenPBS®", "PBS Professional®", and "PBS Pro™" and Altair's logos is
.\" subject to Altair's trademark licensing policies.
.\"
.TH qterm 8B "6 May 2020" Local "PBS Professional"
.SH NAME
.B qterm 
\- terminate one or both PBS servers, and optionally terminate scheduler(s) and/or MoMs

.SH SYNOPSIS
.B qterm 
[-f | -F | -i] [-m] [-s] [-t <type>] [<server>[ <server> ...]]
.br
.B qterm
--version

.SH DESCRIPTION
The
.B qterm 
command terminates a PBS batch server.

Once the server is terminating, no new jobs are accepted by the
server, and no jobs are allowed to begin execution.  The impact on
running jobs depends on the way the server is shut down.

The 
.B qterm 
command does not exit until the server has completed its shutdown procedure.

If the complex is configured for failover, and the primary server is
shut down, the normal behavior for the secondary server is to become
active.  The 
.B qterm 
command provides options to manage the behavior of
the secondary server; it can be shut down, forced to remain idle, or
shut down in place of the primary server.

.B Required Privilege
.br
In order to
run the 
.B qterm 
command, you must have PBS Operator or Manager privilege.

.SH OPTIONS
.IP "(no options)" 10
The 
.B qterm 
command defaults to 
.B qterm -t quick.

.IP "-f" 10
If the complex is configured for failover, shuts down both the primary and
secondary servers.  
.br
Without the 
.I -f 
option, 
.B qterm 
shuts down the the primary server and makes the secondary server active.  
.br
The 
.I -f
option cannot be used with the 
.I -i 
or 
.I -F 
options.

.IP "-F" 10
If the complex is configured for failover, shuts down only the secondary server,
leaving the primary server active.
.br
The 
.I -F 
option cannot be used with the 
.I -f 
or 
.I -i 
options.

.IP "-i" 10
If the complex is configured for failover, leaves the secondary server
idle when the primary server is shut down.
.br
The 
.I -i 
option cannot be used with the 
.I -f 
or 
.I -F 
options.

.IP "-m" 10
Shuts down the primary server and all MoMs 
.B (pbs_mom).
This option does not cause jobs or subjobs to be killed.
Jobs are left running subject to other options to the 
.B qterm
command.  

.IP "-s" 10
Shuts down the primary server and the scheduler
.B (pbs_sched).

.IP "-t <type>" 10
The 
.I type 
specifies how the server is shut down.  The 
.I types
are the following:
.RS
.IP immediate
Shuts down the primary server.  Immediately stops all running jobs.
Any running jobs that can be checkpointed are checkpointed,
terminated, and requeued.  Jobs that cannot be checkpointed are
terminated and requeued if they are rerunnable, otherwise they are
killed.

If any job cannot be terminated, for example the server cannot contact
the MoM of a running job, the server continues to execute and the job
is listed as running.  The server can be terminated by a second 
.B qterm -t immediate 
command.

While terminating, the server is in the 
.I Terminating 
state.

.IP delay 
Shuts down the primary server.  The server waits to terminate until
all non-checkpointable, non-rerunnable jobs are finished executing.
Any running jobs that can be checkpointed are checkpointed,
terminated, and requeued.  Jobs that cannot be checkpointed are
terminated and requeued if they are rerunnable, otherwise they are
allowed to continue to run.

While terminating, the server is in the 
.I Terminating-Delayed 
state.

.IP quick
Shuts down the primary server.  Running jobs and subjobs are left running.

This is the default behavior when no options are given to the 
.B qterm
command.

While terminating, the server is in the 
.I Terminating 
state.

.RE
.LP
.IP "--version" 10
The 
.B qterm
command returns its PBS version information and exits.
This option can only be used alone.

.SH OPERANDS
You optionally specify the list of servers to shut down using 
.I [<server>[ <server> ...].

If you do not specify any servers, the 
.B qterm
command shuts down the default server.

.SH STANDARD ERROR
The
.B qterm
command writes a diagnostic message to standard error for
each error occurrence.

.SH EXIT STATUS
.IP Zero 8
Upon successful processing of all operands presented to the 
.B qterm
command.
.IP "Greater than zero" 8
If the 
.B qterm 
command fails to process any operand

.SH SEE ALSO
pbs_server(8B), pbs_mom(8B), pbs_sched(8B)


